
var vm = new Vue({
	el:'#rrapp',
	data:{
		showList: false,
		title: null,
        number: '',
        menjin:''
	},

    mounted() {
        this.$refs.number.focus();
    },

	methods: {
		saveOrUpdate: function (event) {

		    $('#btnSaveOrUpdate').button('loading').delay(100).queue(function() {

                var matchReg = new RegExp("^JN-+.{2}-\\d{6}$");  //^JN_*[0-9]{3}$
                if(!matchReg.test(vm.number)){
                    $('#btnSaveOrUpdate').button('reset');
                    $('#btnSaveOrUpdate').dequeue();
                    vm.number = "";
                    return;
                }
                $.ajax({
                    type: "POST",
                    url: baseURL + "noc/nocreadcard/save",
                    dataType: "json",
                    data: {
                        barCode: vm.number,
                        pcName:  vm.menjin
                    },
                    success: function(r){
                        if(r.code === 0){
                             //layer.msg("操作成功", {icon: 1});
                             $('#btnSaveOrUpdate').button('reset');
                             $('#btnSaveOrUpdate').dequeue();
                        }else{
                            //layer.alert(r.msg);
                            $('#btnSaveOrUpdate').button('reset');
                            $('#btnSaveOrUpdate').dequeue();
                        }

                    }


                });

                vm.number = "";
			});
		},

        getfocus: function (event) {
            var el = event.currentTarget;
            el.focus();
        }
	}
});